package ttsolver.util;

import ttsolver.enums.PenaltyType;
import ttsolver.enums.TrainType;

public class PenaltyUtil {
	
	public static double getPenalty(PenaltyType pType, TrainType tType) {
		int penalty = 0;
		double discHour = InstantesUtil.getDiscHour();

		switch (pType) {
		case DELAY:
			switch (tType) {
			case A:
				penalty = 600;
				break;
			case B:
				penalty = 500;
				break;
			case C:
				penalty = 400;
				break;
			case D:
				penalty = 300;
				break;
			case E:
				penalty = 150;
				break;
			case F:
				penalty = 100;
				break;
			}
			break;
		case SCHEDULE_DEVIANCE:
			switch (tType) {
			case A:
				penalty = 200;
				break;
			case B:
				penalty = 200;
				break;
			case C:
				penalty = 200;
				break;
			case D:
				penalty = 200;
				break;
			case E:
				penalty = 0;
				break;
			case F:
				penalty = 0;
				break;
			}
			break;
		case TWT_DEVIANCE:
			penalty = 75;
			break;
		case UNPREFERED_TRACK:
			penalty = 50;
			break;
		default:
			penalty = 0;
		}

		return penalty * discHour;
	}
	
	public static double getPenalty(PenaltyType pType) {
		int penalty = 0;
		double discHour = InstantesUtil.getDiscHour();

		switch (pType) {
		case TWT_DEVIANCE:
			penalty = 75;
			break;
		case UNPREFERED_TRACK:
			penalty = 50;
			break;
		default:
			penalty = 0;
			break;
		}

		return penalty * discHour;
	}
	
	public static double getPenaltySec(PenaltyType pType, TrainType tType) {
		int penalty = 0;

		switch (pType) {
		case DELAY:
			switch (tType) {
			case A:
				penalty = 600;
				break;
			case B:
				penalty = 500;
				break;
			case C:
				penalty = 400;
				break;
			case D:
				penalty = 300;
				break;
			case E:
				penalty = 150;
				break;
			case F:
				penalty = 100;
				break;
			}
			break;
		case SCHEDULE_DEVIANCE:
			switch (tType) {
			case A:
				penalty = 200;
				break;
			case B:
				penalty = 200;
				break;
			case C:
				penalty = 200;
				break;
			case D:
				penalty = 200;
				break;
			case E:
				penalty = 0;
				break;
			case F:
				penalty = 0;
				break;
			}
			break;
		case TWT_DEVIANCE:
			penalty = 75;
			break;
		case UNPREFERED_TRACK:
			penalty = 50;
			break;
		default:
			penalty = 0;
		}

		return penalty / 3600.0;
	}
	
	public static double getPenaltySec(PenaltyType pType) {
		int penalty = 0;

		switch (pType) {
		case TWT_DEVIANCE:
			penalty = 75;
			break;
		case UNPREFERED_TRACK:
			penalty = 50;
			break;
		default:
			penalty = 0;
			break;
		}

		return penalty / 3600.0;
	}
}
